<template>
  <scroll id="tab-menu">
    <div class="menu-list">
      <div class="menu-list-item" 
      v-for="(item, index) in categories" 
      :key="index" 
      :class="{active: index == curesIndex}" 
      @click="clickHover(index)"
      >{{item.title}}</div>
    </div>
  </scroll>
</template>

<script>
import Scroll from "@/components/content/scroll/Scroll";

export default {
  props: {
    categories: {
      type: Array,
      defafult() {
        return [];
      }
    }
  },
  data() {
    return {
      curesIndex:0
    };
  },
  components: {
    Scroll
  },
  methods: {
    clickHover(index){
      this.curesIndex = index
      this.$emit('selectItem', index)
    }
  }
};
</script>

<style lang='scss' scoped>
@import "@/assets/css/extend.scss";

#tab-menu {
  background-color: #f6f6f6;
  height: 100%;
  width: 100px;
  box-sizing: border-box;
}

.menu-list-item {
  height: 45px;
  line-height: 45px;
  text-align: center;
  font-size: 14px;
}

.menu-list-item.active {
  font-weight: 700;
  color: $color-high-text;
  background-color: #fff;
  border-left: 3px solid $color-high-text;
}
</style>